const express = require('express')
const app = express()
const api = require("./router/api")

// 解决跨域
app.all('*', (req, res, next) => {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "content-type");
    res.header("Access-Control-Allow-Methods","*");
    res.header("X-Powered-By",' 3.2.1')
    res.header("Content-Type", "application/json;charset=utf-8");
    next();
})



// 嵌套路由
app.use("/api", api)
// app.set('host','192.168.43.6');

app.listen(3000, () => console.log('Example app listening on port 3000!'))